﻿using System.IO;

namespace PlusPlusPaint.FileIO
{
    public class LayeredDataWriter
    {
        #region member variables
        TextWriter textwriter;
        #endregion

        #region constructors
        public LayeredDataWriter(TextWriter tw)
        {
            this.textwriter = tw;
        }
        #endregion

        #region public methods
        public void Write(SerializedObject so)
        {
            AST.CompositeNode cn = new AST.CompositeNode(so);
            AST.TopLevelNode tln = new AST.TopLevelNode();
            tln.AddArg(cn);
            textwriter.Write(tln.ToPrettyString());
            textwriter.Flush();
        }
        #endregion
    }
}
